/*
 * Pwm.c
 *
 * Created: 31.03.2012 09:03:04
 *  Author: KZM
 */ 
#include <avr/io.h>
void InitPwm(void){
	//FASTPWM 10bit 15,625 kHz
	TIMSK|=(0<<TOIE1|0<<TICIE1); //Timer 1 in Compare Modus
	
	TCCR1A|=(1<<COM1A0|1<<COM1A1|1<<COM1B0|1<<COM1B1|1<<WGM11|1<<WGM10);
	TCCR1B|=(0<<CS12|0<<CS11|1<<CS10|0<<WGM13|1<<WGM12);
	OCR1A=0;
	OCR1B=0;
}

void SetMotor1PWM(uint16_t PWM10_t){
	if (PWM10_t > 0x3FE){
		PWM10_t=0x3FE;
	}
	OCR1A=PWM10_t;
}

void SetMotor2PWM(uint16_t PWM10_t){
	if (PWM10_t > 0x3FE){
		PWM10_t=0x3FE;
	}
	OCR1B=PWM10_t;
}
